class Link:
	def __init__(self, priority, link, group):
		self.priority = priority
		self.link = link
		self.group = group
	def __unicode__(self):
		return self.group

class OneLink:
	def __init__(self, url, description):
		self.url = url
		self.description = description
	def __unicode__(self):
		return self.url

def clean_text(text):
	linkDescription = text[0:190]
	linkDescription = unicode(linkDescription).encode('utf-8')
	linkDescription = linkDescription.replace("\"","\'")
	linkDescription = linkDescription.replace("\n"," ")
	linkDescription = linkDescription.replace("\t"," ")
	linkDescription = linkDescription.replace("\r"," ")
	linkDescription = linkDescription.replace("\v"," ")
	return linkDescription

def compose_search_param(keywords):
	search = []
	i = 0
	for k in keywords:
		if i == 1:
			com = keywords[0].keyword.replace(" ", "_")+"+"+keywords[1].keyword.replace(" ", "_")
			search.append(com)
		if i == 2:
			com = keywords[0].keyword.replace(" ", "_")+"+"+keywords[1].keyword.replace(" ", "_")+"+"+keywords[2].keyword.replace(" ", "_")
			search.append(com)
			com = keywords[0].keyword.replace(" ", "_")+"+"+keywords[2].keyword.replace(" ", "_")
			search.append(com)
			com = keywords[1].keyword.replace(" ", "_")+"+"+keywords[2].keyword.replace(" ", "_")
			search.append(com)
			break
		i += 1
	return search
